package kata13;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class CountFileRow2 implements ICountFile {

    public int getFileCount(String filePath) throws IOException {
        int total = 0;
        BufferedReader buffer = new BufferedReader(new FileReader(filePath));
        String line = null;
        while((line=buffer.readLine())!= null){
            String trimStr = line.trim();
            if(trimStr.startsWith("/") || trimStr.startsWith("*") || trimStr.length()<=0){
                continue;
            }else{
                total++;
            }
        }
        if(buffer != null) {
            buffer.close();
        }
        return total;
    }
}
